from django.db import models
from google.appengine.ext import db
from geo.geomodel import GeoModel

   
class GeoDataPt(GeoModel):
    """
    Entity that provides with the geospatial queries capabilities
    """
    # most of the time is the timestamp where we can filter later on
    dimension = db.StringProperty()
    resolution = db.StringProperty()
    measured_value = db.FloatProperty()
    latitude = db.FloatProperty()
    longitude = db.FloatProperty()
    descr = db.StringProperty()    
    dt_dim = db.DateTimeProperty()
    
class DataLoad(db.Model):
    """
    helps keeping track of different loads
    """    
    load_id = db.StringProperty()
    comment = db.StringProperty()
    resolution = db.StringProperty()
    dt_values_taken = db.DateTimeProperty()
    created = db.DateTimeProperty(auto_now_add=True)
    total_entities = db.IntegerProperty()
    
   
class TempDataLoad(db.Model):
    """
    temporary placeholder during the loading process
    it should be deleted 1 day after created
    """
    value = db.FloatProperty()
    # order of loading into the datastore
    order = db.IntegerProperty()
    resolution = db.StringProperty()
    title = db.StringProperty()
    # Unique identifier for further reference
    load = db.StringProperty()
    dateStamped = db.DateTimeProperty()
    dt_expiration = db.DateTimeProperty()
    created = db.DateTimeProperty(auto_now_add=True)
        